package in.developersguide.cxf.quickStart.cxfClient;


import in.developersguide.cxf.quickStart.cxfService.SampleCXF;

import org.apache.cxf.interceptor.LoggingInInterceptor;
import org.apache.cxf.interceptor.LoggingOutInterceptor;
import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;

/**
 * Client Code to Consume WebService
 * @author BFM
 *
 */
public class CXFDemoClient {
   public static void main(String[] args) {
	   JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
	   factory.getInInterceptors().add(new LoggingInInterceptor());
	   factory.getOutInterceptors().add(new LoggingOutInterceptor());
	   factory.setServiceClass(SampleCXF.class);
	   factory.setAddress("http://localhost:9000/SampleCXF");
	   SampleCXF client = (SampleCXF) factory.create();

	   String reply = client.sayHi("HI");
	   System.out.println("Server said: " + reply);
	   System.exit(0); 
}
}
